home *** CD-ROM | disk | FTP | other *** search
/ Cracking 1 / Cracking I..iso / Tools / Ostatní / aPLib v0.26b / aPLib.doc next >
Encoding:
Text File  |  2001-12-15  |  17.6 KB  |  429 lines

  1.                                     __.___  _.___.___
  2.                          _.____.___ \    <  >___<   /
  3.                    __/\__\.        \|    |  .__|_   |_/\_
  4.                   /      \/   /T    \    :  >   |        \
  5.                  /  /\    \   \|     |   |  |__ <   /T    |
  6.                 >   \|     <   |    /    /__\  \|   \|    |
  7.                 |    /_.___|  /__._/|          /|    |   /
  8.                 /__.___\ /______|AnG>__.___\__/_|.__\___/
  9.                          .:the:smaller:the:better:.
  10.  
  11.      Copyright (c) 1998-2000 by Joergen Ibsen / Jibz, All Rights Reserved
  12.  
  13.                     ...ABOUT.........................
  14.                     ...LICENSE.......................
  15.                     ...COMPATIBILITY.................
  16.                     ...CONTENTS......................
  17.                     ...HOW TO USE....................
  18.                     ...FUNCTION DESCRIPTIONS.........
  19.                     ...GREETINGS AND THANKS..........
  20.                     ...GETTING THE LATEST VERSION....
  21.                     ...HOW TO REACH ME...............
  22.  
  23.  
  24. --- ABOUT -------------------------------------------------------------------
  25.  
  26.  aPLib is a compression library based on the compression algorithm used
  27.  in aPACK (my executable compressor). I made this because some people
  28.  needed an easy way to compress data-files.
  29.  
  30.  The compression speed is the same as aPACK (reasonably fast), and
  31.  compression uses 640k of working memory.
  32.  
  33.  Decompression on the other hand does not need any extra memory (in situ),
  34.  and is VERY fast.
  35.  
  36.  The depackers assume that they are given some valid packed code -- if not
  37.  they will propably crash the program. This is to ensure that the depackers
  38.  are as small and easy to understand as possible. If you need any added
  39.  functionality (CRC-checking, encryption, depacked size stored with packed
  40.  data, etc.), just add it yourself.
  41.  
  42.  
  43. --- LICENSE -----------------------------------------------------------------
  44.  
  45.  So far aPLib is GREET-WARE for non-profitable use (if nobody charges money
  46.  for programs that use it) which means that if you use it, then you must
  47.  credit me (well, ain't that cheap!).
  48.  
  49.  If you (or anybody else) plans to sell a program that uses aPLib, then you
  50.  will have to register (look at the end of this file).
  51.  
  52.  The definition of a program that _uses_ aPLib is a program that contains
  53.  any part of aPLib EXCEPT the depackers. So you can sell a program that
  54.  uses data packed with aPLib, but NOT a program that contains any part of
  55.  the compression code.
  56.  
  57.  You may not distribute aPLib without all of the files.
  58.  
  59.  You may not edit or reverse engineer any of the files (except the header
  60.  files and the depackers, which you may edit as long as you do NOT remove
  61.  my copyright notice).
  62.  
  63.  You may not sell aPLib, or any part of it, for money (except for charging
  64.  for the media).
  65.  
  66.  #ifndef _COMMON_SENCE
  67.  
  68.    *** This software is provided "as is". In no event shall I, the author,
  69.    *** be liable for any kind of loss or damage arising out of the use,
  70.    *** abuse or the inability to use this software. USE IT ENTIRELY AT
  71.    *** YOUR OWN RISK!
  72.  
  73.    *** This software comes without any kind of warranty, either expressed
  74.    *** or implied, including, but not limited to the implied warranties of
  75.    *** merchantability or fitness for any particular purpose.
  76.  
  77.    *** If you don't agree with these terms or if your juristdiction does
  78.    *** not allow the exclusion of warranty and liability as stated above
  79.    *** you are NOT allowed to use this software at all.
  80.  
  81.  #else
  82.  
  83.    Bla bla bla .. the usual stuff - you know it anyway:
  84.  
  85.      If anything goes even remotely wrong - blame _yourself_, NOT me!
  86.  
  87.  #endif
  88.  
  89.  
  90. --- COMPATIBILITY -----------------------------------------------------------
  91.  
  92.  The Watcom library works with (at least) Watcom, Borland C++, DOS32,
  93.  TASM32/TLINK32 and VPascal -- and should work with other compilers/linkers
  94.  that can use the OMF format.
  95.  
  96.  The VC library works with (at least) Visual C++, Masm32 and Watcom -- and
  97.  should work with other compilers/linkers that can use the MS COFF format.
  98.  
  99.  The Delphi version works with Delphi and TMT Pascal.
  100.  
  101.  The DJGPP library works with DJGPP and Ada.
  102.  
  103.  The DLL version should work with any Win32 compiler/linker.
  104.  
  105.  
  106. --- CONTENTS ----------------------------------------------------------------
  107.  
  108.  The EXAMPLES\16BIT directory contains:
  109.  
  110.    DEPPACK.NAS ........... Source code for a 16bit depacker for files
  111.                            packed with aPPack (the Watcom example packer)
  112.                            in NASM style.
  113.    DEPPTINY.NAS .......... Source code for a smaller version of DEPPACK.COM
  114.                            (no error or syntax messages) in NASM style.
  115.    HISTORY.TXT ........... Log of METALBRAIN's work on the 16bit port.
  116.    MAKEIT.BAT ............ Batch file to compile the above.
  117.  
  118.  The EXAMPLES\ADA directory contains the following files:
  119.  
  120.    APACDEMO.ADB .......... aPLib Ada demo.
  121.    APLIB.ADB ............. aPLib Ada binding.
  122.    APLIB.ADS ............. aPLib Ada specification.
  123.    APLIBADA.DOC .......... Some documentation of the Ada binding.
  124.    MAKEIT.BAT ............ Batch file to make demo executable.
  125.  
  126.  The EXAMPLES\C directory contains:
  127.  
  128.    APPACK.CPP ............ Example code that packs a file, depacks it again,
  129.                            and checks for errors.
  130.    MAKE_BCC.BAT .......... Batch file to compile and link the above, using
  131.                            the Borland BCC32 compiler.
  132.    MAKE_DJ.BAT ........... Batch file to compile and link the above, using
  133.                            DJGPP.
  134.    MAKE_DLL.BAT .......... Batch file to compile and link the above, using
  135.                            VC++ (executable uses the aPLib dll).
  136.    MAKE_VC.BAT ........... Batch file to compile and link the above, using
  137.                            VC++.
  138.    MAKE_WAT.BAT .......... Batch file to compile and link the above, using
  139.                            the Watcom compiler.
  140.  
  141.  The EXAMPLES\DELPHI directory contains:
  142.  
  143.    ....................... An example packer and depacker written in Delphi.
  144.  
  145.  The EXAMPLES\DLL_ASM directory contains:
  146.  
  147.    APTEST.ASM ............ A little assembler code, that packs and depacks
  148.                            a message to show how the aPLib DLL works.
  149.    APTEST.DEF ............ Definition file for the above.
  150.    MAKEIT.BAT ............ Batch file to compile and link the above.
  151.  
  152.  The EXAMPLES\DOS32 directory contains:
  153.  
  154.    APTEST.ASM ............ A little assembler code, that packs and depacks
  155.                            a message to show how aPLib works with DOS32.
  156.    MAKEIT.BAT ............ Batch file to compile and link the above.
  157.  
  158.  The EXAMPLES\TLINK32 directory contains:
  159.  
  160.    APTEST.ASM ............ A little assembler code, that packs and depacks
  161.                            a message to show how aPLib works with TLINK32.
  162.    APTEST.DEF ............ Definition file for the above.
  163.    MAKEIT.BAT ............ Batch file to compile and link the above.
  164.  
  165.  The EXAMPLES\TMT directory contains:
  166.  
  167.    APLIBU.PAS ............ A Pascal unit, to interface with the Watcom
  168.                            aPLib library.
  169.    MAKEIT.BAT ............ Batch file to make demo executables.
  170.    TESTAPDE.PAS .......... An example program, using aPLib with the above
  171.                            interface unit to decompress a file.
  172.    TESTAPPA.PAS .......... An example program, using aPLib with the above
  173.                            interface unit to compress a file.
  174.  
  175.  The EXAMPLES\VPASCAL directory contains:
  176.  
  177.    APLIB.DEF ............. Interface Definition for APLIB.DLL (OS/2).
  178.    APLIBU.PAS ............ A Pascal unit, to interface with the Watcom
  179.                            aPLib library.
  180.    APLIBUD.PAS ........... Dynamic version of APLIBU.PAS.
  181.    MAKE_EXE.CMD .......... Batch file to make demo executables.
  182.    TESTAPDE.PAS .......... An example program, using aPLib with the above
  183.                            interface unit to decompress a file.
  184.    TESTAPPA.PAS .......... An example program, using aPLib with the above
  185.                            interface unit to compress a file.
  186.  
  187.  The LIB\DELPHI directory contains:
  188.  
  189.    APLIB.OBJ ............. The object file that contains aP_pack.
  190.    DEPACK.OBJ ............ Small decompressor (compiled version of
  191.                            DEPACK.ASM).
  192.    DEPACKF.OBJ ........... Fast decompressor (compiled version of
  193.                            DEPACKF.ASM).
  194.    READ.ME ............... Some info about using the above.
  195.  
  196.  The LIB\DJGPP directory contains:
  197.  
  198.    APLIB.H ............... Include file, that contains the declaration of
  199.                            aP_pack (the function that packs data),
  200.                            aP_depack_asm and aP_depack_asm_fast (depackers).
  201.    APLIB.A ............... The library that contains aP_pack (and all the
  202.                            code needed to pack), aP_depack_asm and
  203.                            aP_depack_asm_fast functions.
  204.  
  205.  The LIB\DLL directory contains:
  206.  
  207.    APLIB.DLL ............. DLL containing aP_pack (and all the code needed
  208.                            to pack), aP_depack_asm and aP_depack_asm_fast
  209.                            functions.
  210.    APLIB.H ............... Include file, that contains the declaration of
  211.                            aP_pack (the function that packs data),
  212.                            aP_depack_asm and aP_depack_asm_fast (depackers).
  213.    APLIB.LIB ............. Import library for implicit linking with VC++.
  214.    READ.ME ............... Some info about using the above.
  215.  
  216.  The LIB\VC directory contains:
  217.  
  218.    APLIB.H ............... Include file, that contains the declaration of
  219.                            aP_pack (the function that packs data),
  220.                            aP_depack_asm and aP_depack_asm_fast (depackers).
  221.    APLIB.LIB ............. The library that contains aP_pack (and all the
  222.                            code needed to pack), aP_depack_asm and
  223.                            aP_depack_asm_fast functions.
  224.  
  225.  The LIB\WATCOM directory contains:
  226.  
  227.    APLIB.H ............... Include file, that contains the declaration of
  228.                            aP_pack (the function that packs data),
  229.                            aP_depack_asm and aP_depack_asm_fast (depackers).
  230.    APLIB.LIB ............. The library that contains aP_pack (and all the
  231.                            code needed to pack), aP_depack_asm and
  232.                            aP_depack_asm_fast functions.
  233.  
  234.  The SRC\ASM directory contains the following files:
  235.  
  236.    DEPACK.ASM ............ Small decompressor in 32bit assembler code for
  237.                            TASM, MASM or WASM assembler.
  238.    DEPACK16.ASM........... Decompressor in 16bit assembler code for TASM,
  239.                            MASM or WASM assembler.
  240.    DEPACKF.ASM ........... Fast decompressor in 32bit assembler code for
  241.                            TASM, MASM or WASM assembler.
  242.    READ.ME ............... Some info about compiling and using the above.
  243.  
  244.  The SRC\C directory contains:
  245.  
  246.    APDEPACK.C ............ Decompressor in C.
  247.    APDEPACK.H ............ Include file for the above.
  248.  
  249.  The SRC\NASM directory contains:
  250.  
  251.    DEPACK.ASM ............ Small decompressor in 32bit assembler code for
  252.                            the NASM assembler.
  253.    DEPACK16.ASM........... Decompressor in 16bit assembler code for the
  254.                            NASM assembler.
  255.    DEPACKF.ASM ........... Fast decompressor in 32bit assembler code for
  256.                            the NASM assembler.
  257.    READ.ME ............... Some info about compiling and using the above.
  258.  
  259.  
  260. --- HOW TO USE --------------------------------------------------------------
  261.  
  262.  So basically you include APLIB.H and link with the library to be able to
  263.  pack and depack. If you only need to depack, or if you modify the depack
  264.  code, you can compile and link with one of the assembler versions of the
  265.  depackers.
  266.  
  267.  Getting data into an input buffer and allocating the output buffer is your
  268.  responsibility. You also need to supply a work buffer for aP_pack -- you
  269.  can get the required size of the work buffer by passing the size of the
  270.  input to the function aP_workmem_size (in the current version this
  271.  function always returns 640k). If some error occurs, aP_pack will return
  272.  0 -- otherwise it returns the compressed size.
  273.  
  274.  If you do not have a callback for aP_pack, use NULL (ie. 0) instead.
  275.  
  276.  The EXAMPLE directory contains simple packers for various languages that
  277.  either use aPLib to compress and decompress a given file, or a string.
  278.  
  279.  
  280. --- FUNCTION DESCRIPTIONS ---------------------------------------------------
  281.  
  282. aP_pack:
  283. --------
  284.  unsigned int aP_pack(unsigned char *source,
  285.                       unsigned char *destination,
  286.                       unsigned int length,
  287.                       unsigned char *workmem,
  288.                       int (*callback) (unsigned int, unsigned int));
  289.  
  290.  source      - is the data you want to compress.
  291.  
  292.  destination - is where the data should be compressed to (It would be a good
  293.                idea to allocate ((length * 9) / 8) + 16 bytes to be sure that
  294.                even an uncompressible file can be "compressed" without a
  295.                page-fault.
  296.  
  297.  length      - is the number of bytes you want to compress.
  298.  
  299.  workmem     - a pointer to (at least) as much memory as aP_workmem_size
  300.                returns. This is used during compression for tables and
  301.                temporary storage needs.
  302.  
  303.  callback    - is a pointer to a function that takes two arguments - the
  304.                first is the number of input bytes that has been compressed,
  305.                and the second is how many output bytes they have been
  306.                compressed to. This function is called every 32nd time the
  307.                main compression loop is run. If you don't have a callback,
  308.                use NULL instead. If the function returns 1 then aP_pack
  309.                will continue packing -- if it returns 0, aP_pack will stop
  310.                and return 0.
  311.  
  312.  returns the packed length (or 0 on any error).
  313.  
  314.  
  315. aP_workmem_size:
  316. ----------------
  317.  unsigned int aP_workmem_size(unsigned int inputsize);
  318.  
  319.  inputsize   - is the number of bytes you want to compress.
  320.  
  321.  returns the required length of the work buffer (currently 640k).
  322.  
  323.  
  324. aP_depack:
  325. ----------
  326.  unsigned int aP_depack(unsigned char *source,
  327.                         unsigned char *destination);
  328.  
  329.  source      - is the compressed data that you want to decompress.
  330.  
  331.  destination - is where your want the compressed data decompressed to.
  332.  
  333.  returns the depacked length.
  334.  
  335.  
  336. aP_depack_asm:
  337. --------------
  338.  unsigned int aP_depack_asm(unsigned char *source,
  339.                             unsigned char *destination);
  340.  
  341.  source      - is the compressed data that you want to decompress.
  342.  
  343.  destination - is where your want the compressed data decompressed to.
  344.  
  345.  returns the depacked length.
  346.  
  347.  
  348. aP_depack_asm_fast:
  349. -------------------
  350.  unsigned int aP_depack_asm_fast(unsigned char *source,
  351.                                  unsigned char *destination);
  352.  
  353.  source      - is the compressed data that you want to decompress.
  354.  
  355.  destination - is where your want the compressed data decompressed to.
  356.  
  357.  returns the depacked length.
  358.  
  359.  
  360. aP_depack16_asm:
  361. ----------------
  362.  unsigned long aP_depack16_asm(unsigned char far *source,
  363.                                unsigned char far *destination);
  364.  
  365.  source      - is the compressed data that you want to decompress.
  366.  
  367.  destination - is where your want the compressed data decompressed to.
  368.  
  369.  returns the depacked length.
  370.  
  371.  
  372.  
  373. --- GREETINGS AND THANKS ----------------------------------------------------
  374.  
  375.  .. go out to the following people:
  376.  
  377.   * d'b for our continous discussions of compression techniques :)
  378.   * TAD for all the great ideas and the good discussions
  379.   * The people who made the Epsilon Compression Page
  380.   * Pasi 'Albert' Ojala for his info on PuCrunch
  381.   * RIT Research Labs for making Dos Navigator .. it's the BEST!
  382.   * LiuTaoTao for making TR .. one of the best debuggers around!
  383.   * Eugene Suslikov (SEN) for making HIEW .. it ROCKS!
  384.   * Veit Kannegieser for his work on the VPascal code
  385.   * METALBRAIN for his work on the 16bit depackers
  386.   * Gautier for his work on the Ada code
  387.   * Netscape for making the best internet browser
  388.   * All other people who make good software freely available for non-
  389.     commercial use!
  390.  
  391.  A special thanks to the beta-testers:
  392.  
  393.   * x-otic (thx mate ;)
  394.   * Oleg Prokhorov (great optimizations and bug repports!)
  395.   * Lawrence E. Boothby
  396.   * METALBRAIN (beleive in miracles, my friend ;)
  397.   * eL PuSHeR
  398.   * Elli
  399.  
  400.  
  401. --- GETTING THE LATEST VERSION ----------------------------------------------
  402.  
  403.  You can find it at:  http://apack.cjb.net/
  404.                       http://members.xoom.com/jibz/apack/news.htm
  405.  Or the SAC archive:  ftp://ftp.elf.stuba.sk/pub/pc/pack/
  406.  
  407.  
  408. --- HOW TO REACH ME ---------------------------------------------------------
  409.  
  410.  Well, if you have any questions, suggestions or bug-reports about aPLib (or
  411.  you just like chatting), this email-address should work:  jibz@hotmail.com
  412.  
  413.  If you think that aPLib is a good library and you like using it - feel
  414.  free to send a money or hardware donation to me (will make me work
  415.  harder ;-). Address at the end of this document, and in REGISTER.FRM.
  416.  
  417.  If you want to register aPLib in order to use it commercially fill out
  418.  the registration form in REGISTER.FRM and mail it to me (if you want a
  419.  company / site license or an update subscription email me).
  420.  
  421.  When you register you will receive a registered version of the libraries.
  422.  
  423.    Joergen Ibsen
  424.    Post Danmark
  425.    Poste Restante
  426.    Veri Centret Posthus
  427.    DK - 8240 Risskov
  428.    Denmark.
  429.